package com.chenyongjing.design.pattern.observer.blog;


import java.util.Observable;

/**
 * @Author chen
 * @Date 2022/12/5 21:20
 */
public class Blog extends Observable {
    private String name = "消息圈";
    private static final Blog blog = new Blog();

    public String getName() {
        return name;
    }

    private Blog(){

    }

    public static Blog getInstance(){
        return  blog;
    }

    public void publish(Message message){
        System.out.println(message.getUserName()+"在"+this.name+"上提交了一条消息");
        setChanged();
        notifyObservers(message);
    }



}
